<template>
  <el-select v-model="value" class="m-2" placeholder="Select">
    <el-option
      v-for="item in options"
      :key="item.value"
      :label="item.label"
      :value="item.value"
    />
  </el-select>
</template>

<script setup>
import { ref } from 'vue'
import useCurrentStore from "@/store/modules/current";
const currentStore =useCurrentStore()
const value = ref('2023')
const currentDate=ref('')
const computedDate = ref('')
watch(value, (val)=>{
currentStore.setCurrent(val)
})
const options = ref([
])
  function getYear() {
      currentDate.value = new Date().getFullYear()
      options.value=[{
      value:currentDate.value ,
      label: currentDate.value,
    },
    {
      value: currentDate.value - 1,
      label: currentDate.value - 1,
    },
    {
      value: currentDate.value - 2,
      label: currentDate.value - 2,
    }]
      computedDate.value = new Date().getFullYear()
    }
getYear()
</script>
<style lang="scss" scope>
  .m-2{
    height: 100%;
    width: 120px;
  }
  .select-trigger{
  position: absolute;
  height: 30px;
  top: 0;
  bottom: 0;
  margin: auto;
  width: 100%;
  }
</style>
